package cn.com.guage.dtm.huawei;

import java.util.HashMap;
import java.util.Scanner;

public class HJ2_计算某字符出现次数 {
    public static void main(String[] args) {
        //实现方法1
        method1();
        //实现方法2
        // method2();
    }

    private static void method1(){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine().toLowerCase();
        String next = sc.next().toLowerCase();
        String[] words = line.split("");
        HashMap<String,Integer> map = new HashMap<String,Integer>();
        for (String word : words) {
            if (map.containsKey(word)) {
                map.put(word, map.get(word) + 1);
            }else {
                map.put(word, 1);
            }
        }
        if (map.get(next) ==null){
            System.out.println(0);
        }else {
            System.out.println(map.get(next));
        }
    }

    private static void method2(){
        Scanner s = new Scanner(System.in);
        String input1= s.nextLine();
        String input2 = s.nextLine();
        String str = input1.toUpperCase().replaceAll(input2.toUpperCase(),"");
        int count = input1.length() - str.length();
        System.out.println(count);
    }
}
